As database queries become increasingly complex, execution costs have also increased, for example, as measured by processing time. Some queries include complex sub-queries that are optimized by some but not all databases. These sub-queries may define overlapping portions of database tables and optimization may include reuse of results for these overlapping portions.